x86/dpci: do not remove pirqs from domain tree on unbind
authorRoger Pau Monné <roger.pau@citrix.com>
Thu, 21 Jan 2021 15:21:04 +0000 (16:21 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 21 Jan 2021 15:21:04 +0000 (16:21 +0100)
commit4170218cb96546426664e5c1d00c5a848a26ae9e
tree32ff7cdef4f354cf170ba7598ec91ef594835cbf
parent9028fd493a69b1e216239542d986240fa1ea7167
x86/dpci: do not remove pirqs from domain tree on unbind

A fix for a previous issue removed the pirqs from the domain tree when
they are unbound in order to prevent shared pirqs from triggering a
BUG_ON in __pirq_guest_unbind if they are unbound multiple times. That
caused free_domain_pirqs to no longer unmap the pirqs because they
are gone from the domain pirq tree, thus leaving stale unbound pirqs
after domain destruction if the domain had mapped dpci pirqs after
shutdown.

Take a different approach to fix the original issue, instead of
removing the pirq from d->pirq_tree clear the flags of the dpci pirq
struct to signal that the pirq is now unbound. This prevents calling
pirq_guest_unbind multiple times for the same pirq without having to
remove it from the domain pirq tree.

This is XSA-360.

Fixes: 5b58dad089 ('x86/pass-through: avoid double IRQ unbind during domain cleanup')
Reported-by: Samuel Verschelde <samuel.verschelde@vates.fr>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 58427889f5a420cc5226f88524b3228f90b72a58
master date: 2021-01-21 16:11:41 +0100
xen/arch/x86/irq.c
xen/drivers/passthrough/pci.c
xen/include/asm-x86/hvm/irq.h